package com.baizhi.cmfz.service.impl;

import com.baizhi.cmfz.annotation.LogAnnotation;
import com.baizhi.cmfz.entity.CmfzBanner;
import com.baizhi.cmfz.entity.CmfzGuru;
import com.baizhi.cmfz.mapper.CmfzGuruMapper;
import com.baizhi.cmfz.service.CmfzBannerService;
import com.baizhi.cmfz.service.CmfzGuruService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class CmfzGuruServiceImpl implements CmfzGuruService {

    @Autowired
    private CmfzGuruMapper gm;
    @Override
    public Page<CmfzGuru> selectAllByPage(Integer page, Integer limit) {
        Page<CmfzGuru> cmfzGuruPage1 = new Page<>(page, limit);
        Page<CmfzGuru> cmfzGuruPage = gm.selectPage(cmfzGuruPage1, null);
        return cmfzGuruPage;
    }

    @Override
    @LogAnnotation(type = "insert",value = "添加法师")
    public void insertGuru(CmfzGuru g) {
        gm.insert(g);
    }

    @Override
    @LogAnnotation(type = "update",value = "修改法师")
    public void updateGuru(CmfzGuru g) {
        gm.updateById(g);
    }

    @Override
    public CmfzGuru selectById(Integer id) {
        return gm.selectById(id);
    }

    @Override
    @LogAnnotation(type = "update",value = "修改法师状态")
    public void updateStatus(CmfzGuru g) {
        gm.updateStatus(g);
    }


}
